﻿#region itdc

/************************************************************************
*Copyright(C) 2015 by qsgy
 *All rights reserved. 
 *FileName:     $safeitemname$
 *Author:       oyh
 *Version:      
 *UnityVersion：
 *Date:   $time$      
 *Description:    
 *History: 
************************************************************************/
#endregion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//传送带
public class ConveyorBelt : MonoBehaviour {

    #region 1

    public float speed = 1f;

    private void OnCollisionStay(Collision collision)
    {
        Collider co = collision.collider;
        if (co.tag == "WorkPiece")
        {
           // print(co.GetComponent<WorkPiece>().isHolding == false);
            if (co.GetComponent<WorkPiece>().isHolding == false)
               // co.transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0));
            co.transform.position += new Vector3(speed * Time.deltaTime, 0, 0);
        }
    } 
    #endregion

    //设置传送带的速度，为负数反向运转
    public void SetSpeed(float s)
    {
        speed = s;
    }



}
